stocks60$stocks_hourly_diff = stocks60$stocks_hourly %>% diff() %>% append(NA, 0) # Difference for moving averages
stocks60$stocks_hourly_diff_ln = stocks60$stocks_hourly %>% log() %>% diff() %>% append(NA, 0) # Log then difference for variance stabilization
stocks60$day_count = stocks60$dt_hourly %>% date() %>% as.integer() - stocks60$dt_hourly %>% date() %>% as.integer() %>% min() + 1 # Counting the days
stocks60$morality =
stocks60$care_p_hourly*stocks60$care_sent_hourly +
stocks60$fairness_p_hourly*stocks60$fairness_sent_hourly +
stocks60$loyalty_p_hourly*stocks60$loyalty_sent_hourly +
stocks60$authority_p_hourly*stocks60$authority_sent_hourly +
stocks60$sanctity_p_hourly*stocks60$sanctity_sent_hourly
stocks60$morality_lag = lag(stocks60$morality) # lag morality index
stocks60$care_p_hourly_lag = lag(stocks60$care_p_hourly) # lag moral probabilities
stocks60$fairness_p_hourly_lag = (stocks60$fairness_p_hourly)
stocks60$loyalty_p_hourly_lag = lag(stocks60$loyalty_p_hourly)
stocks60$authority_p_hourly_lag = lag(stocks60$authority_p_hourly)
stocks60$sanctity_p_hourly_lag = lag(stocks60$sanctity_p_hourly)
stocks60$care_sent_hourly_lag = lag(stocks60$care_sent_hourly) # lag moral sentiments
stocks60$fairness_sent_hourly_lag = lag(stocks60$fairness_sent_hourly)
stocks60$loyalty_sent_hourly_lag = lag(stocks60$loyalty_sent_hourly)
stocks60$authority_sent_hourly_lag = lag(stocks60$authority_sent_hourly)
stocks60$sanctity_sent_hourly_lag = lag(stocks60$sanctity_sent_hourly)
stocks60$care_lag = stocks60$care_p_hourly_lag * stocks60$care_sent_hourly_lag # lag probability*sentiments
stocks60$fairness_lag = stocks60$fairness_p_hourly_lag * stocks60$fairness_sent_hourly_lag
stocks60$loyalty_lag = stocks60$loyalty_p_hourly_lag * stocks60$loyalty_sent_hourly_lag
stocks60$authority_lag = stocks60$authority_p_hourly_lag * stocks60$authority_sent_hourly_lag
stocks60$sanctity_lag = stocks60$sanctity_p_hourly_lag * stocks60$sanctity_sent_hourly_lag
stocks60_ordered = stocks60[, c(1, 24, 2:4, 16:21, 5, 22, 23, 25, 6:15, 27:36, 26, 37:41)] # REORDER COLUMNS
stocks60_ordered %>% colnames() # DISPLAY COL NAMES
## [1] "dt_hourly" "day_count" "season_intraday_hourly" "season_workday_hourly"
## [5] "season_month_hourly" "tf1_hourly" "tf2_hourly" "tf3_hourly"
## [9] "tf4_hourly" "tf5_hourly" "tf6_hourly" "stocks_hourly"
## [13] "stocks_hourly_diff" "stocks_hourly_diff_ln" "morality" "care_p_hourly"
## [17] "fairness_p_hourly" "loyalty_p_hourly" "authority_p_hourly" "sanctity_p_hourly"
## [21] "care_sent_hourly" "fairness_sent_hourly" "loyalty_sent_hourly" "authority_sent_hourly"
## [25] "sanctity_sent_hourly" "care_p_hourly_lag" "fairness_p_hourly_lag" "loyalty_p_hourly_lag"
## [29] "authority_p_hourly_lag" "sanctity_p_hourly_lag" "care_sent_hourly_lag" "fairness_sent_hourly_lag"
## [33] "loyalty_sent_hourly_lag" "authority_sent_hourly_lag" "sanctity_sent_hourly_lag" "morality_lag"
## [37] "care_lag" "fairness_lag" "loyalty_lag" "authority_lag"
## [41] "sanctity_lag"
stocks60ts = ts(stocks60_ordered) # MAKE TIME SERIES
plot(stocks60ts[,"stocks_hourly"]) # PLOT INITIAL DATA
acf(stocks60_ordered$stocks_hourly, lag.max = NULL, type = c("correlation"), plot = TRUE, na.action = na.pass) # ACF FOR NON-TRANSFORMED DATA
acf(stocks60_ordered$stocks_hourly, lag.max = NULL, type = c("partial"), plot = TRUE, na.action = na.pass) # PACF FOR NON-TRANSFORMED DATA
acf(stocks60_ordered$stocks_hourly_diff_ln, lag.max = NULL, type = c("correlation"), plot = TRUE, na.action = na.pass) # ACF FOR TRANSFORMED DATA
acf(stocks60_ordered$stocks_hourly_diff_ln, lag.max = NULL, type = c("partial"), plot = TRUE, na.action = na.pass) # PACF FOR TRANSFORMED DATA
plot(stocks60ts[,"stocks_hourly_diff_ln"]) # UNSTABLE VARIANCE IN CONTRACTION AND RECOVERY PERIOD - NEED GARCH MODEL
# Data Exploration
hist(stocks60_ordered[16:25]) # PROB & SENT
hist(stocks60_ordered[26:35]) # PROB & SENT LAG
hist(stocks60_ordered[, c(15,36)]) # MORALITY & MORALITY LAG
hist(stocks60_ordered[37:41]) # FOUNDATIONS LAG
hist(stocks60_ordered[14]) # TRANSFORMED STOCKS
# VIOLIN
plot_violin <- function(input) {
return(input + geom_violin(trim = FALSE) + stat_summary(fun.data = "mean_sdl", fun.args = list(mult = 1), geom = "pointrange", color = "black"))}
# DOUBLE VIOLIN
plot_violin2 <- function(input) {
return(input + geom_violin(aes(color = tf2_hourly), trim = FALSE,position = position_dodge(0.9)) + geom_boxplot(aes(color = tf2_hourly),width = 0.60, position = position_dodge(0.9)) + scale_color_manual(values = c("#00AFBB","#E7B800")))}
# BOXPLOT
plot_boxplot <- function(input) {
return(input + geom_boxplot(notch = TRUE, fill = "lightgray") +stat_summary(fun.y = mean, geom = "point",shape = 18, size = 2.5, color = "#FC4E07"))}
# SCATTERPLOT
plot_scatter <- function(input) {
return(ggplot(stocks60_ordered, aes(input, stocks_hourly_diff_ln, color=tf2_hourly)) + geom_point() + geom_smooth(method=lm) +scale_color_manual(values = c('#999999','#E69F00')) + theme(legend.position=c(0,1), legend.justification=c(0,1)))}
# X DENSITY
plot_xdensity <- function(input) {
return(ggplot(stocks60_ordered, aes(input, fill=tf2_hourly)) +geom_density(alpha=.5) +scale_fill_manual(values = c('#999999','#E69F00')) + theme(legend.position = "none") )}
# Y DENSITY
plot_ydensity <- function() {return(ggplot(stocks60_ordered, aes(stocks_hourly_diff_ln, fill=tf2_hourly)) +geom_density(alpha=.5) +scale_fill_manual(values = c('#999999','#E69F00')) +theme(legend.position = "none") )}
# BLANK PLOT
plot_blank <- function() {
return(ggplot() + geom_blank(aes(1,1)) +theme(plot.background = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),panel.border = element_blank(), panel.background = element_blank(),axis.title.x = element_blank(),axis.title.y = element_blank(),axis.text.x = element_blank(),axis.text.y = element_blank(),axis.ticks = element_blank()))}
e <- ggplot(stocks60, aes(x = tf2_hourly, y = morality_lag))
plot_boxplot(e) # MORALITY BOX PLOT
plot_violin(e) # MORALITY VIOLIN PLOT
stocks60_foundations_long = melt(stocks60_ordered[, c(7,37:41)])
## Using tf2_hourly as id variables
e1 <- ggplot(stocks60_foundations_long, aes(x = variable, y = value))
plot_violin(e1) # FOUNDATIONS VIOLIN PLOT
plot_boxplot(e1) # FOUNDATIONS BOX PLOT
plot_violin2(e1) # FOUNDATIONS BY TF VIOLIN PLOT
scatterPlot <- plot_scatter(stocks60_ordered$morality_lag)
xdensity <- plot_xdensity(stocks60_ordered$morality_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # MORALITY PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$care_lag)
xdensity <- plot_xdensity(stocks60_ordered$care_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # CARE PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$fairness_lag)
xdensity <- plot_xdensity(stocks60_ordered$fairness_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # FAIRNESS PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$loyalty_lag)
xdensity <- plot_xdensity(stocks60_ordered$loyalty_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # LOYALTY PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$authority_lag)
xdensity <- plot_xdensity(stocks60_ordered$authority_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # AUTHORITY PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$sanctity_lag)
xdensity <- plot_xdensity(stocks60_ordered$sanctity_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # SANCTITY PLOT
## `geom_smooth()` using formula 'y ~ x'
omtted <- na.omit(stocks60_ordered)
outlier_rm_IQR <- function(data, df_str, col_str, threshold){
Q <- quantile(data, probs=c(.25, .75), na.rm = FALSE) # 25/75 QUANTILES AFTER REMOVING ROW 1 (NA row)
iqr <- IQR(data) # IQR AFTER REMOVING ROW 1 (NA row)
upper <- Q[2]+threshold*iqr # Upper Range for outliers
lower <- Q[1]-threshold*iqr # Lower Range for outliers
df <- get(df_str)
column <- get(df_str)[col_str]
a <- subset.data.frame(df, column > lower)
b <- subset.data.frame(df, column < upper)
return(intersect(a,b))
}
a <- outlier_rm_IQR(omtted$morality_lag[-1], "omtted", "morality_lag", 2.5)
b <- outlier_rm_IQR(omtted$stocks_hourly_diff_ln[-1], "omtted", "stocks_hourly_diff_ln", 2.5)
stocks60_outrm <- intersect(a,b)
stocks60_outrm_moralityonly <- outlier_rm_IQR(omtted$morality_lag[-1], "omtted", "morality_lag", 2.5)
stocks60.model.lm <- lm(stocks_hourly_diff_ln ~ tf2_hourly * morality_lag,data = omtted)
stocks60.model.lm.foundations <- lm(stocks_hourly_diff_ln ~ tf2_hourly * (care_lag +fairness_lag +loyalty_lag +authority_lag +sanctity_lag), data = omtted)
stocks60.model.lme.null <-lmer(stocks_hourly_diff_ln ~ 1 + (1|day_count), data = omtted, REML=TRUE)
stocks60.model.lme <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*morality_lag + (1 + season_intraday_hourly | day_count)), data = omtted, REML = TRUE)
## boundary (singular) fit: see ?isSingular
stocks60.model.lme.foundations <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*(care_lag + fairness_lag + loyalty_lag + authority_lag + sanctity_lag) + ( 1 + season_intraday_hourly | day_count)), data = omtted, REML = TRUE)
## boundary (singular) fit: see ?isSingular
stocks60.model.lm.outrm <- lm(stocks_hourly_diff_ln ~ tf2_hourly * morality_lag,data = stocks60_outrm_moralityonly)
stocks60.model.lm.foundations.outrm <- lm(stocks_hourly_diff_ln ~ tf2_hourly * (care_lag +fairness_lag +loyalty_lag +authority_lag +sanctity_lag), data = stocks60_outrm_moralityonly)
stocks60.model.lme.null.outrm <-lmer(stocks_hourly_diff_ln ~ 1 + (1|day_count), data = stocks60_outrm_moralityonly, REML=TRUE)
stocks60.model.lme.outrm <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*morality_lag + (1 + season_intraday_hourly | day_count)), data = stocks60_outrm_moralityonly, REML = TRUE)
## boundary (singular) fit: see ?isSingular
stocks60.model.lme.foundations.outrm <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*(care_lag + fairness_lag + loyalty_lag + authority_lag + sanctity_lag) + ( 1 + season_intraday_hourly | day_count)), data = stocks60_outrm_moralityonly, REML = TRUE)
## boundary (singular) fit: see ?isSingular
Anova(stocks60.model.lm, type="III", test="F")
Anova(stocks60.model.lm.foundations, type="III", test="F")
Anova(stocks60.model.lme.null, type="III", test="F")
Anova(stocks60.model.lme, type="III", test="F")
Anova(stocks60.model.lme.foundations, type="III", test="F")
anova(stocks60.model.lm, stocks60.model.lm.foundations)
anova(stocks60.model.lme.null, stocks60.model.lme, stocks60.model.lme.foundations)
## refitting model(s) with ML (instead of REML)
Anova(stocks60.model.lm.outrm, type="III", test="F")
Anova(stocks60.model.lm.foundations.outrm, type="III", test="F")
Anova(stocks60.model.lme.null.outrm, type="III", test="F")
Anova(stocks60.model.lme.outrm, type="III", test="F")
Anova(stocks60.model.lme.foundations.outrm, type="III", test="F")
anova(stocks60.model.lm.outrm, stocks60.model.lm.foundations.outrm)
anova(stocks60.model.lme.null.outrm, stocks60.model.lme.outrm, stocks60.model.lme.foundations.outrm)
## refitting model(s) with ML (instead of REML)
summ(stocks60.model.lm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1035
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(3,1031) = 16.438, p = 0.000
## R² = 0.046
## Adj. R² = 0.043
##
## Standard errors: OLS
## -------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ----------------------------- -------- -------- -------- -------- -------
## (Intercept) 0.040 -0.027 0.106 1.171 0.242
## tf2_hourly -0.385 -0.547 -0.224 -4.679 0.000
## morality_lag 0.008 -0.055 0.071 0.257 0.798
## tf2_hourly:morality_lag 0.668 0.454 0.882 6.130 0.000
## -------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1035
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2790.960, BIC = 2835.439
## Pseudo-R² (fixed effects) = 0.028
## Pseudo-R² (total) = 0.307
##
## FIXED EFFECTS:
## -----------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ----------------------------- -------- -------- -------- -------- --------- -------
## (Intercept) 0.030 -0.045 0.106 0.788 183.011 0.432
## season_intraday_hourly -0.020 -0.100 0.060 -0.482 172.588 0.630
## tf2_hourly -0.294 -0.452 -0.136 -3.620 196.515 0.000
## morality_lag -0.002 -0.061 0.058 -0.060 554.026 0.953
## tf2_hourly:morality_lag 0.520 0.323 0.717 5.145 839.721 0.000
## -----------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.322
## day_count season_intraday_hourly 0.415
## Residual 0.827
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 173 0.132
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lm.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1022
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(3,1018) = 16.279, p = 0.000
## R² = 0.046
## Adj. R² = 0.043
##
## Standard errors: OLS
## -------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ----------------------------- -------- -------- -------- -------- -------
## (Intercept) 0.040 -0.027 0.107 1.172 0.241
## tf2_hourly -0.349 -0.507 -0.190 -4.308 0.000
## morality_lag 0.018 -0.046 0.082 0.547 0.584
## tf2_hourly:morality_lag 0.591 0.395 0.787 5.925 0.000
## -------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1022
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2757.028, BIC = 2801.393
## Pseudo-R² (fixed effects) = 0.028
## Pseudo-R² (total) = 0.305
##
## FIXED EFFECTS:
## -----------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ----------------------------- -------- -------- -------- -------- --------- -------
## (Intercept) 0.030 -0.045 0.106 0.788 182.568 0.432
## season_intraday_hourly -0.016 -0.096 0.064 -0.391 172.599 0.696
## tf2_hourly -0.267 -0.422 -0.111 -3.339 185.272 0.001
## morality_lag 0.006 -0.055 0.066 0.175 650.228 0.861
## tf2_hourly:morality_lag 0.462 0.281 0.643 4.980 834.161 0.000
## -----------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.320
## day_count season_intraday_hourly 0.413
## Residual 0.828
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 173 0.130
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lm.foundations, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1035
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(11,1023) = 5.955, p = 0.000
## R² = 0.060
## Adj. R² = 0.050
##
## Standard errors: OLS
## --------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ------------------------------ -------- -------- -------- -------- -------
## (Intercept) 0.039 -0.027 0.106 1.163 0.245
## tf2_hourly -0.276 -0.447 -0.104 -3.155 0.002
## care_lag 0.075 -0.103 0.252 0.825 0.409
## fairness_lag -0.078 -0.292 0.136 -0.715 0.475
## loyalty_lag 0.072 -0.133 0.278 0.691 0.490
## authority_lag -0.046 -0.242 0.150 -0.463 0.644
## sanctity_lag -0.014 -0.172 0.144 -0.169 0.866
## tf2_hourly:care_lag -0.674 -1.247 -0.101 -2.307 0.021
## tf2_hourly:fairness_lag 0.084 -0.504 0.673 0.281 0.779
## tf2_hourly:loyalty_lag 0.552 -0.015 1.119 1.911 0.056
## tf2_hourly:authority_lag -0.084 -0.604 0.437 -0.316 0.752
## tf2_hourly:sanctity_lag 0.747 0.283 1.210 3.162 0.002
## --------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme.foundations, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1035
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2805.326, BIC = 2889.342
## Pseudo-R² (fixed effects) = 0.045
## Pseudo-R² (total) = 0.323
##
## FIXED EFFECTS:
## ------------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ------------------------------ -------- -------- -------- -------- --------- -------
## (Intercept) 0.034 -0.043 0.111 0.860 180.896 0.391
## season_intraday_hourly -0.027 -0.106 0.052 -0.664 172.953 0.507
## tf2_hourly -0.202 -0.368 -0.037 -2.383 219.127 0.018
## care_lag 0.109 -0.060 0.278 1.252 727.539 0.211
## fairness_lag -0.093 -0.295 0.109 -0.895 987.151 0.371
## loyalty_lag 0.010 -0.188 0.209 0.099 902.378 0.921
## authority_lag 0.003 -0.184 0.191 0.036 922.871 0.971
## sanctity_lag -0.031 -0.181 0.120 -0.400 554.885 0.689
## tf2_hourly:care_lag -0.641 -1.173 -0.109 -2.349 894.731 0.019
## tf2_hourly:fairness_lag 0.070 -0.489 0.629 0.245 980.418 0.806
## tf2_hourly:loyalty_lag 0.710 0.161 1.260 2.517 816.791 0.012
## tf2_hourly:authority_lag -0.394 -0.899 0.111 -1.517 848.052 0.130
## tf2_hourly:sanctity_lag 0.703 0.258 1.147 3.082 996.763 0.002
## ------------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.336
## day_count season_intraday_hourly 0.406
## Residual 0.822
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 173 0.143
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lm.foundations.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1022
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(11,1010) = 5.859, p = 0.000
## R² = 0.060
## Adj. R² = 0.050
##
## Standard errors: OLS
## --------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ------------------------------ -------- -------- -------- -------- -------
## (Intercept) 0.040 -0.027 0.107 1.167 0.243
## tf2_hourly -0.244 -0.412 -0.076 -2.851 0.004
## care_lag 0.063 -0.102 0.228 0.753 0.452
## fairness_lag -0.056 -0.255 0.144 -0.549 0.583
## loyalty_lag 0.062 -0.129 0.253 0.634 0.526
## authority_lag -0.040 -0.221 0.142 -0.429 0.668
## sanctity_lag -0.010 -0.157 0.137 -0.138 0.891
## tf2_hourly:care_lag -0.608 -1.133 -0.083 -2.273 0.023
## tf2_hourly:fairness_lag 0.061 -0.472 0.595 0.226 0.822
## tf2_hourly:loyalty_lag 0.509 -0.013 1.031 1.914 0.056
## tf2_hourly:authority_lag -0.078 -0.554 0.398 -0.322 0.747
## tf2_hourly:sanctity_lag 0.680 0.254 1.106 3.130 0.002
## --------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme.foundations.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1022
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2883.948, BIC = 2967.750
## Pseudo-R² (fixed effects) = 0.056
## Pseudo-R² (total) = 0.163
##
## FIXED EFFECTS:
## ------------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ------------------------------ -------- -------- -------- -------- --------- -------
## (Intercept) 0.039 -0.024 0.102 1.222 165.471 0.223
## season_intraday_hourly -0.022 -0.097 0.053 -0.567 172.936 0.572
## tf2_hourly -0.249 -0.409 -0.088 -3.020 230.535 0.003
## care_lag 0.064 -0.096 0.225 0.779 584.171 0.436
## fairness_lag -0.055 -0.253 0.143 -0.538 928.374 0.591
## loyalty_lag 0.041 -0.147 0.229 0.423 746.519 0.672
## authority_lag -0.010 -0.188 0.168 -0.107 759.603 0.914
## sanctity_lag -0.022 -0.165 0.121 -0.297 475.753 0.767
## tf2_hourly:care_lag -0.501 -1.018 0.015 -1.889 864.044 0.059
## tf2_hourly:fairness_lag -0.003 -0.531 0.525 -0.011 886.520 0.991
## tf2_hourly:loyalty_lag 0.572 0.047 1.097 2.119 756.630 0.034
## tf2_hourly:authority_lag -0.037 -0.506 0.431 -0.156 699.423 0.876
## tf2_hourly:sanctity_lag 0.545 0.118 0.973 2.485 923.361 0.013
## ------------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.000
## day_count season_intraday_hourly 0.329
## Residual 0.918
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 173 0.000
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
plot1 <- interact_plot(stocks60.model.lm, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.outrm, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lme, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lme.outrm, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = care_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = care_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = fairness_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = fairness_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = loyalty_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = loyalty_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = authority_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = authority_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = sanctity_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = sanctity_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)